<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0047)http://rikrikrik.com/jquery/shortkeys/#examples -->
<HTML xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"><HEAD profile="http://gmpg.org/xfn/11"><META http-equiv="Content-Type" content="text/html; charset=UTF-8">
	
	<TITLE>rikrikrik.com  -  jQuery shortKeys plug-in</TITLE>

	<LINK rel="stylesheet" href="./jquery.shortkeys_files/style.css" type="text/css" media="screen">
	<LINK rel="alternate" type="application/rss+xml" title="rikrikrik.com RSS Feed" href="http://rikrikrik.com/feed/">
	<LINK rel="icon" href="http://rikrikrik.com/favicon.png" type="image/png">
	<SCRIPT type="text/javascript" src="./jquery.shortkeys_files/jquery.js"></SCRIPT>
	<SCRIPT type="text/javascript" src="./jquery.shortkeys_files/global.js"></SCRIPT>
	<SCRIPT type="text/javascript" src="./jquery.shortkeys_files/jquery.shortkeys.js"></SCRIPT>	
	<SCRIPT type="text/javascript">	
		$(document).ready(function() {
			$(document).shortkeys({
				'N':          function () { $('#try_me').append('N<br />'); },
				'M':          function () { $('#try_me').append('M<br />'); },
				'Space':      function () { $('#try_me').append('Space<br />'); },
				'Space+V':    function () { $('#try_me').append('Space+V<br />'); },
				'V':          function () { $('#try_me').append('V<br />'); },
				't+y':        function () { $('#try_me').append('T+Y<br />'); },
				't+u':        function () { $('#try_me').append('T+U<br />'); }
			});
		});
	</SCRIPT>
</HEAD><BODY>

<DIV id="ctr" class="clear">
	<DIV id="ctr_inner" class="maxi clear">
		<DIV id="hdr">
			<H1><A href="http://rikrikrik.com/" style="background-position: 0% 100%; "><STRONG><SPAN class="hide">rikrikrik.com</SPAN></STRONG></A></H1>
			<P>— the home of <STRONG>Rik&nbsp;Lomas</STRONG>, a web developer and technology writer, specialising in HTML, CSS and JavaScript. <A href="http://rikrikrik.com/about/">More about me »</A></P>
						<H3>jQuery plug-ins</H3>
			<UL>
				<LI><A href="http://rikrikrik.com/jquery/quicksearch/">quicksearch</A></LI>
				<LI><A href="http://rikrikrik.com/jquery/magicpreview/">magicpreview</A></LI>
				<LI><A href="http://rikrikrik.com/jquery/autosave">autosave</A></LI>
				<LI><A href="http://rikrikrik.com/jquery/pager">pager</A></LI>
				<LI><A href="http://rikrikrik.com/jquery/shortkeys">shortkeys</A></LI>
			</UL>
					</DIV>
		<DIV id="main" class="plugins clear">
<DIV id="jquerypage">
	<DIV id="content">
						<DIV class="post clear" id="post-61">
				<H2><A href="http://rikrikrik.com/jquery/shortkeys/" rel="bookmark" title="Permanent Link to jQuery shortKeys plug-in">jQuery shortKeys plug-in</A></H2>
				<UL>
<LI><A href="./jquery.shortkeys_files/jquery.shortkeys.htm">Examples</A></LI>
<LI><A href="http://rikrikrik.com/jquery/shortkeys/#usage">Usage</A></LI>
<LI><A href="http://rikrikrik.com/jquery/shortkeys/#options">Options</A></LI>
<LI><A href="http://rikrikrik.com/jquery/shortkeys/#known_bugs">Known bugs</A></LI>
<LI><A href="http://rikrikrik.com/jquery/shortkeys/#download">Download</A></LI>
</UL>
<H3 id="examples">Examples</H3>
<DIV id="try_me">
<P><STRONG>Try me!</STRONG> The keyboard shortcuts are:</P>
<UL>
<LI>n</LI>
<LI>m</LI>
<LI>Space</LI>
<LI>Space and v</LI>
<LI>v</LI>
<LI>t and y</LI>
<LI>t and u</LI>
</UL></DIV>
<P>Example uses following code:</P>
<P><CODE>
</CODE></P><CODE><PRE>$(document).shortkeys({
  'N':       function () { $('#try_me').append('N&lt;br /&gt;'); },
  'M':       function () { $('#try_me').append('M&lt;br /&gt;'); },
  'Space':   function () { $('#try_me').append('Space&lt;br /&gt;'); },
  'Space+V': function () { $('#try_me').append('Space+V&lt;br /&gt;'); },
  'V':       function () { $('#try_me').append('V&lt;br /&gt;'); },
  't+y':     function () { $('#try_me').append('T+Y&lt;br /&gt;'); },
  't+u':     function () { $('#try_me').append('T+U&lt;br /&gt;'); }
});
</PRE>
</CODE><P></P>
<H3 id="usage">Usage</H3>
<P><CODE>
</CODE></P><CODE><PRE>$(document).shortkeys(json_obj, options);
</PRE>
</CODE><P></P>
<P>or</P>
<P><CODE>
</CODE></P><CODE><PRE>$(document).keys(json_obj, options);
</PRE>
</CODE><P></P>
<H3 id="options">Options</H3>
<DL>
<DT>split</DT>
<DD>String to split keystring into separate keys</DD>
<DD class="default">default: ‘+’.</DD>
<DT>moreKeys</DT>
<DD>For adding more keys to the database.</DD>
<DD class="default">takes: { ‘Keystring’: keyCode } e.g. { ‘Space’: 32, ‘.’: 190 } default: {}</DD>
</DL>
<H3 id="known_bugs">Known bugs</H3>
<UL>
<LI>Won’t work with Shift, Alt, Ctrl keys in Safari</LI>
<LI>Some clashes with browser shortcuts, especially in Opera</LI>
</UL>
<H3 id="download">Download</H3>
<UL>
<LI><A href="./jquery.shortkeys_files/jquery.shortkeys.js">Full Javascript</A></LI>
<LI><A href="http://rikrikrik.com/js/jquery.shortkeys.txt">Text version</A></LI>
</UL>
			</DIV>
				</DIV>
</DIV>

		</DIV>
	</DIV>
</DIV>


<DIV id="ftr" class="clear">
	<DIV>
	<P>© Rik Lomas 2006-2008 all rights reserved.</P>
	<P>No part may be reproduced without the written permission of the copyright owner, unless otherwise stated</P>
	</DIV>
</DIV>

<SCRIPT type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</SCRIPT><SCRIPT src="./jquery.shortkeys_files/ga.js" type="text/javascript"></SCRIPT>
<SCRIPT type="text/javascript">
var pageTracker = _gat._getTracker("UA-159733-6");
pageTracker._trackPageview();
</SCRIPT>



</BODY></HTML>